package co.yixiang.modules.qeCode.enums.operation.res;

import co.yixiang.modules.qeCode.enums.QrCodeActionEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
@Accessors(chain = true)
public class QrCodeResult<T, K> {

	private String url;

	private T data;

	private K param;

	public static <T, K> QrCodeResult<T, K> ok(String url, T data, K param) {
		
		return QrCodeResult.<T, K>builder().data(data).param(param).url(url).build();
	}

	public static  <T, K> QrCodeResult<T, K> ok(QrCodeActionEnum qrCodeActionEnum, T data, K param) {
		return QrCodeResult.<T, K>builder().data(data).param(param).url(qrCodeActionEnum.getUrl()).build();
	}

	public static  <T, K> QrCodeResult<T, K> notJump(T data, K param) {
		return QrCodeResult.<T, K>builder().data(data).param(param).url("").build();
	}
}
